#! /bin/bash

CONDA_ENV_PATH="$(conda info --base)/envs/{{env.conda_env_name}}"
export PATH="$CONDA_ENV_PATH/bin:$PATH"

{% if connection_yaml_paths %}
{% if show_comment %}
# hack: for some unknown reason, without this ls, the connection creation will be failed
{% endif %}
ls
ls /connections
{% endif %}
{% for connection_yaml_path in connection_yaml_paths %}
pf connection create --file /{{ connection_yaml_path }}
{% endfor %}
echo "start promptflow serving with worker_num: 8, worker_threads: 1"
cd /flow
gunicorn -w 8 --threads 1 -b "0.0.0.0:8080" --timeout 300 "promptflow.core._serving.app:create_app()"
